<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2021/8/6
  Time: 19:05
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <%
        String path = request.getContextPath();
        String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
    %>
    <!-- 基准路径 -->
    <base href="<%=basePath%>">
    <title>Title</title>
    <script>
        function changeCode() {
            var img = document.getElementById("img");
            img.src = "code?time="+new Date();
        }
    </script>
    <style>
        input{
            height: 35px;
            background-color:transparent;
            color:	#00FFFF;
            font-size: 20px;
        }
        table{
                color:blue;
            font-size: 20px;
            margin-left: 300px;
            width: 600px;
            height: 300px;
           align-content: center;
            margin-top:210px;
        }
        body{
            background-image: url("/img/56.jpg" ) ;
                background-size: 100%;
            }
        h2{
            color: blue;
        }
    </style>
</head>
<body >

<%
    //获取Cookie的值
    Cookie[] cookies = request.getCookies();
    if(cookies!=null){
        for (Cookie ck:cookies){
            if("username".equals(ck.getName())){
                pageContext.setAttribute("username", ck.getValue());
                pageContext.setAttribute("checked", "checked");
            }

            if("password".equals(ck.getName())){
                pageContext.setAttribute("password", ck.getValue());
            }
        }
    }
%>
<form action="user?method=login" method="post">
    <table border="1px" cellspacing="0" >
        <tr>
            <td colspan="2" align="center" ><h2>图&nbsp;&nbsp;&nbsp;书&nbsp;&nbsp;&nbsp;登&nbsp;&nbsp;&nbsp;录&nbsp;&nbsp;&nbsp;页&nbsp;&nbsp;&nbsp;面</h2></td>
        </tr>
        <tr>
            <td> 用户名:</td>
            <td><input type="text" name="username"  value="${username}" ></td>
        </tr>
        <tr>
            <td> 密码:</td>
            <td><input type="password" name="password" value="${password}" ></td>
        </tr>
        <tr>
            <td>验证码:</td>
            <td> <input type="text" name="code">&nbsp;&nbsp;&nbsp;<img id="img" src="code" onclick="changeCode()"></td>
        </tr>
        <tr>
            <td> <input type="submit" value="登录" style="color:#0000CD ;">
            </td>
            <td>
                <input type="checkbox" ${checked} name="s" value="1">&nbsp;&nbsp;记住密码
                <span style="color: red;">${error}</span></td>
        </tr>
    </table>
</form>
</body>
</html>
